﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CrossGenGUI
{
    public partial class Options : Form
    {
        new Main ParentForm;

        public Options()
        {
            InitializeComponent();
        }

        public Options(Main Parent)
        {
            InitializeComponent();
            ParentForm = Parent;
        }

        private void radioButton11_CheckedChanged(object sender, EventArgs e)
        {
            if (radioButton11.Checked) textBox1.ReadOnly = false;
            else
            {
                textBox1.Text = "";
                textBox1.ReadOnly = true;
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int diff = 1;
            string vocname = "Dictionaries\\general.cdic";
            string gridname = "Crosswords\\medium.cgg";
            int count;
            bool isNeedToFill;

            if (checkBox1.Checked) isNeedToFill = true;
            else isNeedToFill = false;

            if (radioButton1.Checked) diff = 0;
            if (radioButton2.Checked) diff = 1;
            if (radioButton3.Checked) diff = 2;

            if (radioButton4.Checked) vocname = "Dictionaries\\general.cdic";
            if (radioButton5.Checked) vocname = "Dictionaries\\tech.cdic";
            if (radioButton6.Checked) vocname = "Dictionaries\\history.cdic";

            if (radioButton11.Checked)
            {
                count = Convert.ToInt32(textBox1.Text);
                if (count > 9 && count < 31)
                {
                    ParentForm.CreateCross(vocname, count, diff, isNeedToFill);
                }
            }
            else
            {

                if (radioButton8.Checked) gridname = "Crosswords\\small.cgg";
                if (radioButton9.Checked) gridname = "Crosswords\\medium.cgg";
                if (radioButton10.Checked) gridname = "Crosswords\\big.cgg";

                ParentForm.CreateCross(vocname, gridname, diff, isNeedToFill);
            }
        }
    }
}
